package com.qs.cwams.util;

import java.util.Arrays;

/**
 * @author suncheng
 */
public enum ApplyType {
    TYPE_E(-1, "异常", 0),
    TYPE_0(0, "事假", 1),
    TYPE_1(1, "病假", 1),
    TYPE_2(2, "年假", 1),
    TYPE_3(3, "婚假", 1),
    TYPE_4(4, "丧假", 1),
    TYPE_5(5, "产假", 1),
    TYPE_6(6, "陪产假", 1),
    TYPE_7(7, "忘打卡", 2),
    TYPE_8(8, "调休", 1),
    TYPE_9(9, "外出", 1),
    TYPE_10(10, "加班", 3),
    TYPE_11(11, "出差", 1);

    private final int val;

    private final String name;

    private final int group;

    ApplyType(int val, String name, int group) {
        this.val = val;
        this.name = name;
        this.group =group;
    }

    public static String getName(int type) {
        return Arrays.stream(ApplyType.values()).filter(item -> item.val == type).findAny().orElse(TYPE_E).name;
    }

    public static int getGroup(int type) {
        return Arrays.stream(ApplyType.values()).filter(item -> item.val == type).findAny().orElse(TYPE_E).group;
    }
}
